<template>
  <div>
    <div class="container">
      <div class="float-button">
        <img class="aside-button" :src="$store.state.userImg" @click="showAside">
        <a href="#top"><img class="top-button" :src="$store.state.userImg"></a>
      </div>
      <div class="aside-container" :class="{'aside-container-hide': isHideAside}">
        <!--侧边栏-->
        <div class="aside">
          <!--头像-->
          <img class="avatar" :src="$store.state.userImg" alt="头像">
          <!--总概览 文章数 标签数 分类数-->
          <div class="overview">
            <ul>
              <li>文章{{' ' + articleCount}}</li>
              <li>标签{{' ' + tagCount}}</li>
              <li>分类{{' ' + catalogCount}}</li>
            </ul>
          </div>
          <!--时间轴-->
          <div class="timeline">
            <h3 class="title">时间轴</h3>
            <ul>
              <li v-for="item in 2" :key="'时间轴' + item">文章{{item}}</li>
            </ul>
          </div>
          <!--标签展示-->
          <div class="tag-overview">
            <h3 class="title">标签</h3>
            <ul>
              <li v-for="item in tag" :key="'标签' + item">{{item}}</li>
            </ul>
          </div>
          <!--分类展示-->
          <div class="catalog">
            <h3 class="title">目录</h3>
            <ul>
              <li v-for="item in tag" :key="'目录' + item">目录：{{item}}</li>
            </ul>
          </div>

        </div>
      </div>
      <!--内容区域-->
      <div class="content-container">
        <!--回顶部-->
        <a name="top"></a>
        <div class="content">
          <!--文章概览-->
          <div class="article-area">
            <ol>
              <li class="article" v-for="item in 3" :key="'文章' + item">
                <img :src="$store.state.userImg" alt="文章图片">
                <div class="title"><h2>标题</h2></div>
                <div class="article-introduce">介绍{{item}}</div>
              </li>
            </ol>
          </div>
          <!--分页跳转-->
          <div class="paging">
            <ol>
              <li class="page-item">上一页</li>
              <li class="page-item" v-for="item in 5" :key="'分页' + item">{{item}}</li>
              <li class="page-item">下一页</li>
            </ol>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
  export default {
    name: "myArticle",
    data() {
      return {
        isHideAside: true,
        tag: [
            'Vue',
            '前端',
            'JAVA',
            'HTML',
            'CSS',
            'JS',
            'Yarn',
            'Git'
        ]
      }
    },
    computed: {
      articleCount() {
        return 2
      },
      tagCount() {
        return 1
      },
      catalogCount() {
        return 3
      }
    },
    methods: {
      showAside() {
        this.isHideAside = !this.isHideAside
        console.log(this.isHideAside);
      }
    }
  }
</script>

<style lang="less" scoped>
  @import "~@/styles/views/defaultValue.less";
  @import "~@/styles/views/styleAndAnimation.less";

  /* 公共 */
  .container {
    position: relative;
    width: @containerWidth;
    min-width: @phoneMin;
    height: 100vh;
    margin: 0 auto;
    overflow: hidden;

    .float-button {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: fixed;
      z-index: 999;
      bottom: 5px;
      right: 5px;
      background-color: @areaBackground;
      border-radius: @borderRadius;

      a {
        font-size: 0;
      }

      .aside-button,
      .top-button {
        margin: 20px;
        border-radius: @borderRadius;
      }
    }
    /*侧边栏样式*/
    .aside-container {
      transform: translateX(0);
      z-index: 5;
      height: 100%;
      margin: 0 5px;
      overflow: auto;
      background: @areaBackground;
      transition: all 1s;

      .hideScroll();

      .aside {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;

        /*侧边栏公共部分*/
        .overview,
        .timeline,
        .tag-overview,
        .catalog {
          width: 90%;
          margin: 10px auto;
          border-radius: @borderRadius;
          background: @itemBackgroundColor;

          .title {
            margin: 10px;
            text-align: center;
          }
        }

        /*头像*/
        .avatar {
          width: 70%;
          margin: 20px auto;
          border-radius: 50%;
        }

        /*总概览*/
        .overview {
          ul {
            display: flex;
            justify-content: space-around;
            padding: 10px 0;
            margin: 10px 5px;
          }
        }

        /*时间轴*/
        .timeline,
        .catalog {
          ul {
            display: flex;
            flex-direction: column;
            margin: 10px;

            li {
              margin: 8px;
            }
          }
        }

        /*标签总览*/
        .tag-overview {
          ul {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            margin: 10px;

            li {
              padding: 8px;
              margin: 4px;
              border-radius: 8px;
              background: mediumspringgreen;
            }
          }
        }
      }
    }
    .content-container {
      height: 100%;
      margin: 0 5px;
      background: @areaBackground;
      overflow: auto;
      transition: all 1s;

      .hideScroll();

      .article-area {
        width: 95%;
        margin: 10px auto;

        .article {
          margin: 10px 0;
          overflow: hidden;
          background: @itemBackgroundColor;
          border-radius: @borderRadius * 2;

          img {
            width: 100%;
          }

          .title {
            margin: 20px 10px;
          }

          .article-introduce {
            margin: 20px 10px;
          }
        }
      }
      .paging {
        width: 95%;
        margin: 10px auto ;

        ol {
          display: flex;
          justify-content: center;
          margin: 10px 0;
          background: @itemBackgroundColor;
          border-radius: @borderRadius * 2;

          .page-item {
            min-width: 30px;
            margin: 10px;
            padding: 10px;
            text-align: center;
            border-radius: @borderRadius * 2;
            border: black solid 1px;
          }
        }
      }
    }
  }
  /* 电脑 */
  @media screen and (min-width: @IPadAndPC) {
    .container {
      display: flex;
      .aside-container {
        flex: 20%;
        max-width: 500px;
      }
      .content-container {
        flex: 70%;
      }
    }
  }

  /* 平板 手机*/
  @media screen and (max-width: @IPadAndPC) {
    .container {
      .aside-container {
        position: absolute;
        max-width: 30%;
        min-width: 250px;
      }
      .aside-container-hide {
        transform: translateX(-110%);
      }
    }
  }

</style>